package com.xposed.aliproxy.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.xposed.aliproxy.R;
import com.xposed.aliproxy.db.AliTradeModel;

import java.util.ArrayList;

public class AliTradeDetailAdapter extends BaseAdapter {
    private Context f0a;
    private ArrayList<AliTradeModel> f1b;

    public Object getItem(int i) {
        return null;
    }

    public long getItemId(int i) {
        return 0;
    }

    public AliTradeDetailAdapter(Context context, ArrayList<AliTradeModel> arrayList) {
        this.f0a = context;
        this.f1b = arrayList;
    }

    public int getCount() {
        return this.f1b.size();
    }

    public View getView(int i, View view, ViewGroup viewGroup) {
        View inflate = view == null ? View.inflate(this.f0a, R.layout.view_alitradedetaillist_item, null) : view;
        AliTradeModel aliTradeModel = (AliTradeModel) this.f1b.get(i);
        String amount = aliTradeModel.getAmount();
        String remark = aliTradeModel.getRemark();
        String date = aliTradeModel.getDate();
        String name = aliTradeModel.getName();
        String tradeNo = aliTradeModel.getTradeNo();
        String status = aliTradeModel.getStatus();
        String aliBalance = aliTradeModel.getAliBalance();
        TextView textView = (TextView) inflate.findViewById(R.id.view_alitradedetaillist_item_amount);
        TextView textView2 = (TextView) inflate.findViewById(R.id.view_alitradedetaillist_item_status);
        TextView textView3 = (TextView) inflate.findViewById(R.id.view_alitradedetaillist_item_remark);
        TextView textView4 = (TextView) inflate.findViewById(R.id.view_alitradedetaillist_item_date);
        TextView textView5 = (TextView) inflate.findViewById(R.id.view_alitradedetaillist_item_name);
        TextView textView6 = (TextView) inflate.findViewById(R.id.view_alitradedetaillist_item_tradeNo);
        TextView textView7 = (TextView) inflate.findViewById(R.id.view_alitradedetaillist_item_balance);
        StringBuilder stringBuilder = new StringBuilder();
        View view2 = inflate;
        stringBuilder.append("金额：");
        stringBuilder.append(amount);
        textView.setText(stringBuilder.toString());
        StringBuilder stringBuilder2 = new StringBuilder();
        stringBuilder2.append("余额：");
        stringBuilder2.append(aliBalance);
        textView7.setText(stringBuilder2.toString());
        StringBuilder stringBuilder3 = new StringBuilder();
        stringBuilder3.append("备注：");
        stringBuilder3.append(remark);
        textView3.setText(stringBuilder3.toString());
        stringBuilder3 = new StringBuilder();
        stringBuilder3.append("姓名：");
        stringBuilder3.append(name);
        textView5.setText(stringBuilder3.toString());
        stringBuilder3 = new StringBuilder();
        stringBuilder3.append("时间：");
        stringBuilder3.append(date);
        textView4.setText(stringBuilder3.toString());
        stringBuilder3 = new StringBuilder();
        stringBuilder3.append("订单号：");
        stringBuilder3.append(tradeNo);
        textView6.setText(stringBuilder3.toString());
        if ("0".equals(status)) {
            textView2.setText("状态：等待上送");
        } else if ("1".equals(status)) {
            textView2.setText("状态：成功");
        }
        return view2;
    }
}
